<?php
/**
 * 系統名稱: Lotto 系統
 * 檔案說明: 專案管理-修改
 * $Author$
 * $Id$
 *
 */
include_once("../../config.inc.php");

session_start();
$_LangPath = "account_agent";
$strTemplatePath = __Admintemplate_Path."/AccountNew/";
include_once(__Language_Path."/selectlanguage_admin.php");
include_once(__Modules_Path."/SQLUtility.lib.php");
include_once(__Common_Path."/Lotto.inc.php");
include_once(__Modules_Path."/Account.lib.php");
include(__Common_Path."/SysParam.inc.php");

/*if(file_exists($_SERVER["DOCUMENT_ROOT"]."/tmp/lock.countResult")){
	$GLOBALS["errormessage"] = $_strAccount_Agent["onCountResult"];//"結帳中，請稍後！！";
	ErrMsgOutputHTML("LoginError", "", 1);
}*/

$arrPower = CheckUsePower("account");
if($arrPower === false)ErrMsgOutputHTML("Error", "", 1);

$isLimit = true;
$isSevenDay = false;
switch($arrPower[1]){
	case "agent-sub":
		include_once(__Admin_Path."/logincheck_old.php");
		$data["SubID_n"] = $_SESSION["Admin_Info"] -> ParentID;
		$isSevenDay = true;
		break;

	case "main-sub":
		include_once(__Admin_Path."/logincheck_old.php");
		$data["MainID_n"] = $_SESSION["Admin_Info"] -> ParentID;
		$isSevenDay = true;
		$data["SubID_n"] = (int)$_data["SubID"];
		break;

	case "stockholder-sub":
		include_once(__Admin_Path."/logincheck_old.php");
		$data["StockID_n"] = $_SESSION["Admin_Info"] -> ParentID;
		$data["MainID_n"] = (int)$_data["MainID"];
		$data["SubID_n"] = (int)$_data["SubID"];
		break;

	case "director-sub":
		include_once(__Admin_Path."/logincheck_old.php");
		$data["DirectorID_n"] = $_SESSION["Admin_Info"] -> ParentID;
		$data["MainID_n"] = (int)$_data["MainID"];
		$data["SubID_n"] = (int)$_data["SubID"];
		break;

	case "agent":
		include_once(__Admin_Path."/logincheck_old.php");
		$data["SubID_n"] = $_SESSION["Admin_Info"] -> ID;
		$isSevenDay = true;
		break;

	case "main":
		include_once(__Admin_Path."/logincheck_old.php");
		$data["MainID_n"] = $_SESSION["Admin_Info"] -> ID;
		$isSevenDay = true;
		$data["SubID_n"] = (int)$_data["SubID"];
		break;

	case "stockholder":
		include_once(__Admin_Path."/logincheck_old.php");
		$data["StockID_n"] = $_SESSION["Admin_Info"] -> ID;
		$data["MainID_n"] = (int)$_data["MainID"];
		$data["SubID_n"] = (int)$_data["SubID"];
		/*if($_SESSION["Admin_Info"] -> isAllAccount == 1){
			$data["StockID_n"] = (int)$_data["StockID"];
			if($_SESSION["Admin_Info"] -> ParentisAllAccount != 1){
				$data["DirectorID_n"] = $_SESSION["Admin_Info"] -> ParentID;
			}
		}*/
		break;

	case "director":
		include_once(__Admin_Path."/logincheck_old.php");
		$data["DirectorID_n"] = $_SESSION["Admin_Info"] -> ID;
		$data["MainID_n"] = (int)$_data["MainID"];
		$data["SubID_n"] = (int)$_data["SubID"];
		if($_SESSION["Admin_Info"] -> isAllAccount == 1){
			$data["DirectorID_n"] = "";
		}
		break;

	case "all":
		$isLimit = false;
	case "all-limit":
		include_once(__Admin_Path."/logincheck_old.php");
		$data["MainID_n"] = (int)$_data["MainID"];
		$data["SubID_n"] = (int)$_data["SubID"];
		break;

	case "all-old":
		$isLimit = false;
	case "all-old-limit":
		include_once(__Admin_Path."/logincheck_old.php");
		$data["MainID_n"] = (int)$_data["MainID"];
		$data["SubID_n"] = (int)$_data["SubID"];
		break;

	default:
		include_once(__Admin_Path."/logincheck_old.php");
		$title = "Error";
		$GLOBALS["errormessage"] =  $_strAccount_Agent["NoPower"]; //""很抱歉！您沒有此程式的使用權限！";
		ErrMsgOutputHTML("Error", "", 1);
		break;
}
$isLimit = false;
if(isRestrictReport()){
	$GLOBALS["errormessage"] = $_strAccount_Agent["onCountResult"];//"結帳中，請稍後！！";
	ErrMsgOutputHTML("Error", "", 1);
}
$PayupDate[0] = $_data["PayupDate_0"];
$PayupDate[1] = $_data["PayupDate_1"];

switch($_data["op"]){
	case "List":							//清單
		include_once(__Modules_Path."/Gamble.lib.php");
		include_once("Sub_List.php");
		break;

	default:									//搜尋表單
		include_once(__Modules_Path."/Lotto.lib.php");
		include_once(__Modules_Path."/BetType.lib.php");
		include_once("Sub_Search.php");
		break;
}

@mysql_close($$_Conn);
?>